import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Collection{
    List<Object> person = new ArrayList<>();
    public void add(Object per){
        if (per instanceof Person) {
            person.add(per);
            System.out.println("添加成功");
        }else {
            System.out.println("存储错误");
        }
    }
    public void print(){
        for (Object obj: person) {
            System.out.println(obj.toString());
        }
    }
}
